package com.hhh.springai_test.model.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 社区帖子表
 * @TableName community_post
 */
@TableName(value ="community_post")
@Data
public class CommunityPost {
    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 帖子标题
     */
    private String title;

    /**
     * 帖子内容(MD格式)
     */
    private String content;

    /**
     * 分类编码
     */
    private String categorycode;

    /**
     * 标签编码
     */
    private Integer tagcode;

    /**
     * 点赞数
     */
    private Integer likecount;

    /**
     * 评论数
     */
    private Integer commentcount;

    /**
     * 阅览数
     */
    private Integer viewcount;

    /**
     * 审核状态(0:未审核,1:已审核,2:已下架)
     */
    private Integer auditstatus;

    /**
     * 创建用户id
     */
    private Long createuser;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createtime;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updatetime;

    /**
     * 是否删除
     */
    @TableLogic
    private Integer isdelete;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        CommunityPost other = (CommunityPost) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
            && (this.getContent() == null ? other.getContent() == null : this.getContent().equals(other.getContent()))
            && (this.getCategorycode() == null ? other.getCategorycode() == null : this.getCategorycode().equals(other.getCategorycode()))
            && (this.getTagcode() == null ? other.getTagcode() == null : this.getTagcode().equals(other.getTagcode()))
            && (this.getLikecount() == null ? other.getLikecount() == null : this.getLikecount().equals(other.getLikecount()))
            && (this.getCommentcount() == null ? other.getCommentcount() == null : this.getCommentcount().equals(other.getCommentcount()))
            && (this.getViewcount() == null ? other.getViewcount() == null : this.getViewcount().equals(other.getViewcount()))
            && (this.getAuditstatus() == null ? other.getAuditstatus() == null : this.getAuditstatus().equals(other.getAuditstatus()))
            && (this.getCreateuser() == null ? other.getCreateuser() == null : this.getCreateuser().equals(other.getCreateuser()))
            && (this.getCreatetime() == null ? other.getCreatetime() == null : this.getCreatetime().equals(other.getCreatetime()))
            && (this.getUpdatetime() == null ? other.getUpdatetime() == null : this.getUpdatetime().equals(other.getUpdatetime()))
            && (this.getIsdelete() == null ? other.getIsdelete() == null : this.getIsdelete().equals(other.getIsdelete()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
        result = prime * result + ((getContent() == null) ? 0 : getContent().hashCode());
        result = prime * result + ((getCategorycode() == null) ? 0 : getCategorycode().hashCode());
        result = prime * result + ((getTagcode() == null) ? 0 : getTagcode().hashCode());
        result = prime * result + ((getLikecount() == null) ? 0 : getLikecount().hashCode());
        result = prime * result + ((getCommentcount() == null) ? 0 : getCommentcount().hashCode());
        result = prime * result + ((getViewcount() == null) ? 0 : getViewcount().hashCode());
        result = prime * result + ((getAuditstatus() == null) ? 0 : getAuditstatus().hashCode());
        result = prime * result + ((getCreateuser() == null) ? 0 : getCreateuser().hashCode());
        result = prime * result + ((getCreatetime() == null) ? 0 : getCreatetime().hashCode());
        result = prime * result + ((getUpdatetime() == null) ? 0 : getUpdatetime().hashCode());
        result = prime * result + ((getIsdelete() == null) ? 0 : getIsdelete().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", title=").append(title);
        sb.append(", content=").append(content);
        sb.append(", categorycode=").append(categorycode);
        sb.append(", tagcode=").append(tagcode);
        sb.append(", likecount=").append(likecount);
        sb.append(", commentcount=").append(commentcount);
        sb.append(", viewcount=").append(viewcount);
        sb.append(", auditstatus=").append(auditstatus);
        sb.append(", createuser=").append(createuser);
        sb.append(", createtime=").append(createtime);
        sb.append(", updatetime=").append(updatetime);
        sb.append(", isdelete=").append(isdelete);
        sb.append("]");
        return sb.toString();
    }
}